import Uni from '@uni-helper/plugin-uni'
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vite'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    Uni(),
    // 集成UnoCSS
    UnoCSS({
      // 减少重复导入警告
      mode: 'global'
    }),
  ],
  // 配置 z-paging 支持
  transpileDependencies: ['z-paging'],
  css: {
    preprocessorOptions: {
      scss: {
        // 取消sass废弃API的报警
        silenceDeprecations: ['legacy-js-api', 'color-functions', 'import', 'global-builtin'],
        // 静默所有弃用警告
        quietDeps: true,
        // 静默弃用警告
        verbose: false,
      },
    },
  },
  server: {
    host: '0.0.0.0',
    port: 5000,
    proxy: {
      '/dev-api': {
        target: 'https://u.x-verse.cn.lu/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/dev-api/, ''),
      },
    },
  },
})
